package demo;

import com.lijinjiang.beautyeye.BeautyEyeLNFHelper;

import javax.swing.*;
import java.awt.*;

/**
 * @ClassName demo.JTabbedPaneDemo
 * @Description TODO
 * @Author Li
 * @Date 2022/8/23 14:39
 * @ModifyDate 2022/8/23 14:39
 * @Version 1.0
 */
public class JTabbedPaneDemo {
    public static void main(String[] args) {
        try {
            BeautyEyeLNFHelper.frameBorderStyle = BeautyEyeLNFHelper.FrameBorderStyle.generalNoTranslucencyShadow;
            com.lijinjiang.beautyeye.BeautyEyeLNFHelper.launchBeautyEyeLNF();
            UIManager.put("RootPane.setupButtonVisible", false); // 隐藏设置按钮
            UIManager.put("SplitPaneDivider.TOUCH_DECORATED_BUTTON_W", 0); // 设置分隔线装饰按钮的宽度，设置为 0，则不显示该装饰按钮
        } catch (Exception e) {
        }

        JTabbedPane tab = new JTabbedPane();
        String filename = JTabbedPane.class.getResource("/").getPath() + "images/close.png";
        ImageIcon icon = new ImageIcon(filename);
        icon.setImage(icon.getImage().getScaledInstance(20, 20, Image.SCALE_DEFAULT));

        tab.addTab(" 对象 ", new JPanel());
        JPanel panel = new JPanel();
        panel.setOpaque(false);
        panel.setBackground(tab.getBackground());
        panel.setLayout(new BorderLayout());
        JLabel title = new JLabel(" 对象 ");
        title.setBackground(tab.getBackground());
        panel.add(title, BorderLayout.WEST);
        JLabel iconLabel = new JLabel();
        iconLabel.setBackground(tab.getBackground());
        iconLabel.setIcon(icon);
        panel.add(iconLabel, BorderLayout.EAST);

        tab.setTabComponentAt(0, panel);

        tab.addTab(" Info ", new JPanel());

        tab.setFocusable(false);


        JFrame frame = new JFrame();
        frame.setSize(1200, 900);
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        frame.add(tab);
        frame.setLocationRelativeTo(null); // 居中
        frame.setVisible(true);
    }
}
